<?php
// +----------------------------------------------------------------------
// | OneKeyAdmin [ Believe that you can do better ]
// +----------------------------------------------------------------------
// | Copyright (c) 2020-2023 http://onekeyadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: MUKE <513038996@qq.com>
// +----------------------------------------------------------------------
namespace plugins\cms\api\model;

use think\Model;
use app\index\addons\Url;

class Banner extends Model
{
    protected $name = 'cms_banner';

    // 搜索器
    public function searchCatalogIdAttr($query, $value, $array)
    {
        if (! empty($value)) {
            $query->where("catalog_id", 'find in set', $value);
        }
    }

	// 获取器
    public function getUrlAttr($value, $array)
    {
        return Url::appoint(json_decode($value ,true));
    }
}